# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_jted_session_id'
  
  SVN_REPOSITORY='/home/james/svn_repository/jimix'
  
  def svn_get_current_revision
    str = `svn info file://#{SVN_REPOSITORY}/trunk`

    # parse the returned string, looking for the revision count
    idx = str.index 'Revision:'
    # from there, look for the colon
    colon = str.index ':', idx
    # and look for the newline
    newline = str.index "\n", idx
    # substring between them
    puts colon
    puts newline
    revision_str = str[colon+1..newline]
    # return the integer value
    return revision_str.to_i
  end
  
end
